Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #441
What I originally thought was a tree-shaking bug turned out to be way more complicated.
So, here's what was going on.
transform
hook to check if a file was known to theProcessor
instance and then remove the file being transformed, all the files that depended on that file, and all the files it depended on.Processor
instances was passed to the rollup plugin (like when usingmodular-css-svelte
).So, how to fix it? The answer for now is to support both flows!
If a file is already in the tree the code needs to check how many times it's run a build. If it's the first time do the light removal that only removes that file and the files that depend on it. If this is a watch-triggered multi-build then the aggressive removal step needs to be taken to also remove all the files the target file depends on.
phew